<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');class MY_Controller extends CI_Controller {	/**    * CI句柄    *     * @access private    * @var object    */	private $_CI;		function __construct(){		parent::__construct();		$this->_CI = & get_instance();		$this->check_login ();	}		function check_login () { 		if (!$this->_CI->session->userdata('logged_in')) { 			$url = "https://open.weixin.qq.com/connect/oauth2/authorize?";			$url .= "appid=" . WX_API_APPID;			$url .= "&redirect_uri=" . base_url() . "oauth2";			$url .= "&response_type=code&scope=snsapi_base&state=123#wechat_redirect"; 			redirect($url);		} 	}}